//
//  CartDataTool.m
//  JiaoX
//
//  Created by jiaoxiu－005 on 15/1/14.
//  Copyright (c) 2015年 北京娇羞科技有限公司. All rights reserved.
//  购物车网络请求封装类

#import "CartDataTool.h"

@implementation CartDataTool

+(void)cartInfoWithParam:(NSDictionary *)param success:(void (^)(CartInfo *))success failure:(void (^)(NSError *))failure
{
    [self postWithUrl:[NSString stringWithFormat:@"%@cart/buyCart",BASE_URL] param:param hasT:YES resultClass:[CartInfo class] success:success failure:failure];

}

+(void)postCartProdsWithParam:(NSDictionary *)param success:(void (^)(CartInfo *))success failure:(void (^)(NSError *))failure
{
    [self postWithUrl:[NSString stringWithFormat:@"%@cart/update",BASE_URL] param:param hasT:YES resultClass:[CartInfo class] success:success failure:failure];

}

+(void)addCartProdWithParam:(NSDictionary *)param success:(void (^)(CartInfo *))success failure:(void (^)(NSError *))failure
{
    [self postWithUrl:[NSString stringWithFormat:@"%@cart/add",BASE_URL] param:param hasT:YES resultClass:[CartInfo class] success:success failure:failure];
}

+(void)deleteCartProdWithParam:(NSDictionary *)param success:(void (^)(CartInfo *))success failure:(void (^)(NSError *))failure
{
    [self postWithUrl:[NSString stringWithFormat:@"%@cart/delete",BASE_URL] param:param hasT:YES resultClass:[CartInfo class] success:success failure:failure];
}

+(void)getAccountCenterDataWithParam:(NSDictionary *)param success:(void (^)(AddressAndCheckProdInfo *))success failure:(void (^)(NSError *))failure
{
    [self postWithUrl:[NSString stringWithFormat:@"%@cart/accountCenter",BASE_URL] param:param hasT:YES resultClass:[AddressAndCheckProdInfo class] success:success failure:failure];
}

+(void)addOrderWithParam:(NSDictionary *)param success:(void (^)(AddOrderRes *))success failure:(void (^)(NSError *))failure
{
    [self postWithUrl:[NSString stringWithFormat:@"%@order/add",BASE_URL] param:param hasT:YES resultClass:[AddOrderRes class] success:success failure:failure];
}
@end
